package concurrency.chapter3;

/**
 * FileName: VolatileDemo
 * Author:   周壮
 * Date:     2020/5/23 16:45
 * Description:
 */
public class VolatileDemo {

    private volatile static boolean stop = false;

    public static void main(String[] args) throws InterruptedException {

//        Thread thread = new Thread(() -> {
//
//            int i = 0;
//            while (!stop) {
//                i ++;
//            }
//        });
//
//        thread.start();
//        Thread.sleep(1000);
        stop = true;
    }

}
